home *** CD-ROM | disk | FTP | other *** search
- Subject: Embedding help ASAP!
- Sent: 9/17/96 3:52 PM
- Received: 9/17/96 3:52 PM
- From: Adam Nash <adamnash@CS.Stanford.EDU>
- Reply-To: ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List
-
-
- Hi Everyone,
- I am trying to embed an empty sound part into my container
- when people click on the sound button. However, I am at a loss as
- to how to find the right "type" to embed. Basically, the idea is
- to embed an empty sound, then opening the proxy window so they can
- record what they want to.
- (Yes, this will not work if they are using a sound part that
- doesn't support record...)
-
- Can anyone help? How do I embed an empty document of the sound
- type? What is the sound type?
-
- Thanx,
- Adam
-
-
- PS Here is the code I am using currently...
-
- void CSparkFrame::DoCaptureSound(Environment *ev)
- {
- // First Get the selected index
- ODSLong index = GetSelection(ev)->GetSelectedIndex();
-
- // If nothing is selected, get the next empty cell
- if (index == BAD_CELL_INDEX) {
- index = fSparkContent->GetNextEmptyCellIndex();
- }
-
- // Get the proxy for the index
- CSparkProxy *proxy = fSparkContent->GetProxy(index);
-
- // If it's full, get the next empty one
- if (proxy != NULL) {
- index = fSparkContent->GetNextEmptyCellIndex();
- }
-
- // Adjust view bounds, if necessary
- if (index > fSparkView->GetMaxIndex()) {
- long handle_overfill_here;
- SysBeep(1);
- }
-
- // Get the proxy shape
- FW_CRect cellRect;
- fSparkView->GetCellRect(ev, index, cellRect);
- cellRect.Place(FW_kZeroPoint);
-
- // Acquire the shape
- FW_CAcquiredODShape shape = ::FW_NewODShape(ev, cellRect);
-
- // Ask our draft for the new part
- ODStorageUnit *su = fSparkPart->GetStorageUnit(ev);
- ODDraft *draft = su->GetDraft(ev);
- FW_CAcquiredODPart newPart = draft->CreatePart(ev, kODCategorySampledSound, kODNoEditor);
-
- FW_ASSERT(newPart != NULL);
-
- // Create a proxy for the part
- // Name Hack...
- proxy = new CSparkProxy(ev, fSparkPart, fSparkContent, "Untitled Sound", 123456L, FW_CTime::GetCurrentTime());
-
- // Embed the part into our content
- proxy->Embed(ev, GetPresentation(ev), newPart, GetODFrame(ev), kODFrameObject, shape,
- GetPresentation(ev)->GetDefaultEmbeddedFrameViewType(ev),
- NULL, 0, false, false);
-
- // Select the proxy
- SelectCell(ev, index);
-
- // Open the window for the part
- proxy->OpenInWindow(ev, proxy->GetProxyFrame(ev, this));
- }